package com.xuexiang.xuidemo.slice.guideview;

import com.xuexiang.xuidemo.ResourceTable;
import com.xuexiang.xuidemo.slice.BaseAbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;

/**
 * 引导页
 */
public class GuideViewAbilitySlice extends BaseAbilitySlice {

    protected void onStart(Intent intent) {
        super.onStart(intent);
    }

    @Override
    protected int getUIContentLayoutId() {
        return ResourceTable.Layout_ability_slice_guideview;
    }

    @Override
    protected void initComponents() {
        super.initComponents();
        findComponentById(ResourceTable.Id_guide_queue).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                startQueueSlice();
            }
        });
        findComponentById(ResourceTable.Id_guide_queue_sub).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                startQueueSlice();
            }
        });
        findComponentById(ResourceTable.Id_guide_style).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                startStyleSlice();
            }
        });
        findComponentById(ResourceTable.Id_guide_style_sub).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                startStyleSlice();
            }
        });
        findComponentById(ResourceTable.Id_guide_splash).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                present(new SplashAbilitySlice(), new Intent());
            }
        });
    }

    private void startQueueSlice() {
        present(new GuideCaseViewQueueAbilitySlice(), new Intent());
    }

    private void startStyleSlice() {
        present(new GuideCaseViewStyleAbilitySlice(), new Intent());
    }

    @Override
    protected int getTitleBarId() {
        return ResourceTable.Id_title_bar;
    }
}
